package com.lzy.elasticserch.config;

import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceBuilder;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.jdbc.core.JdbcTemplate;

import javax.sql.DataSource;

/**
 * 数据源配置
 */
@Configuration
public class DataSourceConfig {


    @Bean(name = "contentDataSource")
    @ConfigurationProperties("spring.datasource.druid.face")
    public DataSource getContentSource(){
        return DruidDataSourceBuilder.create().build();
    }

    @Bean(name = "contentJdbcTemplate")
    public JdbcTemplate getContentJdbcTemplate(@Qualifier(value = "contentDataSource") DataSource dataSource){
        return new JdbcTemplate(dataSource);
    }












}
